import React from "react";

import { storiesOf } from "@storybook/react";
import { number } from "@storybook/addon-knobs";
// import { withSmartKnobs } from 'storybook-addon-smart-knobs'

import Pagination from ".";

storiesOf("Pagination", module)
  .add("Pagination", () => {
    const [curPage, setCurPage] = React.useState(10)
    const [curSize, setCurSize] = React.useState(10)
    return (
      <div className=''>
        <Pagination
          defaultCurrent={number('DefaultCurrent', 1)}
          total={number('Total', 100)}
          pageSize={curSize === 10 && curPage === 10 ? number('pageSize', curSize) : curSize}
          current={curSize === 10 && curPage === 10 ? number('Current', curPage) : curPage}
          onChange={(current, size) => { console.info(current, size); setCurPage(current); setCurSize(size) }}
          onShowSizeChange={(current, size) => { console.info(current, size); setCurPage(current); setCurSize(size) }}
          showTotal={(total, range) => `${range[0]}-${range[1]} of ${total} items`}
          showQuickJumper
          showSizeChanger
        />
      </div>
    )
  });